//https://www.acwing.com/solution/content/233469/
package acm.蓝桥19;

import java.util.Arrays;
import java.util.BitSet;
import java.util.Scanner;

/**
 * 先对所有数做一个在x轴的投影，在做离散化 最后以贴海报的模板
 */
public class E闷骚版的贴海报问题 {
	static long[][] info;
	static long[] sort;
	static int n;
	static int tn;
	static int size;
	static int maxN = (int) 1e4;
	static Tree[] tree;
	static int p=(int) 1e1;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		long x = sc.nextInt()*p;
		long y = sc.nextInt()*p;
		info = new long[n + 1][3];
		for (int i = 1; i <= n; i++) {
			long x1 = sc.nextLong()*p;
			long ay = sc.nextLong()*p;
			long len = sc.nextLong()*p;
			long x2 = x1 + len;
			if (x != x1) {
				long k1 = (y - ay) / (x - x1);
				info[i][0] = x - y / k1;
			} else {
				info[i][0] = x1;
			}
			if (x != x2) {
				long k2 = (y - ay) / (x - x2);
				info[i][1] = x - y / k2;
			} else {
				info[i][1] = x2;
			}
			info[i][2]=ay;
		}
		int size = agge(info);
		tn = (int) Math.pow(2, 1 + Math.ceil(Math.log(size) / Math.log(2)));
		tree = new Tree[tn];
		build(1, 1, size);
		for (int i = 1; i <= n; i++) {
			info[i][0] = rank(info[i][0]);
			info[i][1] = rank(info[i][1]);
		}
		//按高度排序
		Arrays.sort(info,1,info.length,(a,b)->{
			if(a[2]!=b[2]) {
				return (int)(a[2]-b[2]);
			}
			if(a[0]!=b[0]) {
				return a[0]<b[0]?-1:1;
			}
			//长的在前小的在后
			return a[1]<b[1]?1:-1;
		});
		for (int i = 1; i <= n; i++) {
			update(1, (int)info[i][0], (int)info[i][1], i);
		}
		int ans = bfs();
		System.out.println(ans);
	}

	private static void update(int i, int l, int r, int id) {
		if (l <= tree[i].l && tree[i].r <= r) {
			tree[i].updateLazy(id);
		} else {
			push(i);
			int m = tree[i].l + tree[i].r >> 1;
			if (l <= m)
				update(i << 1, l, r, id);
			if (m < r)
				update(i << 1 | 1, l, r, id);
		}
	}

	public static int bfs() {
		BitSet map = new BitSet(size * 2);
		int[] queue = new int[size + 10];
		int h = 0, t = 0;
		queue[t++] = 1;
		while (h != t) {
			int cur = queue[(h++) % queue.length];
			if (tree[cur].lazy) {
				map.set(tree[cur].id);
			} else {
				int l = cur << 1;
				int r = l | 1;
				if (l < tn && tree[l] != null) {
					queue[(t++) % queue.length] = cur << 1;
				}
				if (r < tn && tree[r] != null) {
					queue[(t++) % queue.length] = cur << 1 | 1;
				}
			}
		}
		return map.cardinality();
	}

	public static void push(int i) {
		if (tree[i].lazy) {
			tree[i << 1].updateLazy(tree[i].id);
			tree[i << 1 | 1].updateLazy(tree[i].id);
			tree[i].lazy = false;
			tree[i].id = 0;
		}
	}

	private static void build(int i, int l, int r) {
		tree[i] = new Tree(l, r);
		if (l == r)
			return;
		int m = l + r >> 1;
		build(i << 1, l, m);
		build(i << 1 | 1, m + 1, r);
	}

	private static int agge(long[][] info) {
		sort = new long[4 * info.length];
		int cnt = 0;
		for (int i = 1; i <= n; i++) {
			sort[cnt++] = info[i][0];
			sort[cnt++] = info[i][1];
		}
		Arrays.sort(sort, 0, cnt);
		size = cnt;
		cnt = 0;
		sort[cnt++] = sort[0];
		// 去重
		for (int i = 1; i < size; i++) {
			if (sort[i] != sort[i - 1]) {
				sort[cnt++] = sort[i];
			}
		}
		// 补数
		size = cnt;
		for (int i = 1; i < size; i++) {
			if (sort[i - 1] != sort[i] - 1) {
				sort[cnt++] = sort[i] - 1;
			}
		}
		size = cnt;
		Arrays.sort(sort, 0, size);
		return size;
	}

	public static int rank(long v) {
		int l = 1, r = size - 1;
		while (l <= r) {
			int m = l + r >> 1;
			if (sort[m] < v) {
				l = m + 1;
			} else {
				r = m - 1;
			}
		}
		return l+1;
	}

	static class Tree {
		int l, r;
		int id;
		boolean lazy;

		public Tree(int l, int r) {
			this.l = l;
			this.r = r;
		}

		public void updateLazy(int id) {
			this.id = id;
			lazy = true;
		}
	}

}
